package com.onpositive.data.serializer.readers;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.LinkedHashSet;

import com.onpositive.data.AbstractReader;
import com.onpositive.data.serializer.writers.AbstractWriter;

public class MemoryReader extends AbstractReader<Object>{

	public MemoryReader(Class<Object> clazz) {
		super(clazz);
	}
	
	protected ArrayList<Object>sm=new ArrayList<Object>();

	@Override
	public Object getObject(int i) {
		return sm.get(i);
	}
	@Override
	public void setValue(int num, Object value) {
		sm.set(num, value);
	}

	@Override
	protected void doInit() {
		
	}

	@Override
	public void filterOut(LinkedHashSet<Object> obj, String text) {
		
	}

	@Override
	public boolean accept(int op, int a, Object constraint) {
		throw new UnsupportedOperationException();
	}

	public void append(Object o){
		sm.add(o);
	}
	
	public void set(int num,Object o){
		sm.set(num, o);
	}

	@Override
	public Object aggregate(int op, BitSet ss) {
		return null;
	}
	@Override
	public AbstractWriter<Object> getWriter() {
		throw new IllegalStateException();
	}
	@Override
	public void initEmpty(int dataSize) {
		
	}
	@Override
	public void expand(int newSize) {
		
	}
}
